package cn.tedu.mm.admin.account.controller;

import cn.tedu.mm.admin.account.pojo.param.UserParam;
import cn.tedu.mm.admin.account.pojo.vo.UserStandardVO;
import cn.tedu.mm.admin.account.service.UserService;
import cn.tedu.mm.common.pojo.authentication.CurrentPrincipal;
import cn.tedu.mm.common.web.JsonResult;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/admin/user")
public class UserController {

    @Resource
    UserService userService;


    @GetMapping("/list")
    public JsonResult userList(){
        List<UserStandardVO> voList = userService.userList();
        System.out.println(voList);
        return JsonResult.ok(voList);
    }


    @PostMapping("/disabled")
    public JsonResult userDelete(UserParam userParam){
        userService.disabledUser(userParam);
        return JsonResult.ok();
    }

    @PostMapping("/update")
    public JsonResult userUpdate(UserParam userParam){
        userService.updateUser(userParam);
        return JsonResult.ok();
    }

}
